This invention relates to computer software testing tools, and more particularly, it relates to a method and apparatus for determining which program statements have been executed.
An important aspect of software quality assurance is the comprehensiveness of the testing. Without the assistance of special tools, it is difficult, if not impossible, to accurately determine "coverage", i.e., which program instructions are executed when test cases are run. It is therefore difficult to know which test cases to run or when to stop test case development.
In the prior art, there are two principal types of tools for measuring the coverage of test cases. The first type are tools that use pre-processors to modify source code before it is compiled. Procedure calls are inserted at the beginning of program blocks for keeping track of whether a block has been executed. There are several drawbacks to this approach. These tools are language-specific; that is, the preprocessors must be tailored to the syntax of the source language. The size of the object code is changed by the procedure calls, which can change the execution characteristics of the program. Programs must be pre-processed and recompiled for measurement, and then restored or recompiled for production use or product release. The use of preprocessors not only requires an extra step, it also makes these tools impractical for measuring operating system code and time-critical programs.
The second type of coverage measurement tool in the prior art uses sampling techniques to periodically read the program counter and accumulate statistics on how much time is spent in predetermined memory address ranges. Histograms are developed which can be matched up with the programs load map. These tools are useful for evaluating program performance, but, because they use sampling, they cannot be used to determine which instructions have not been executed.
What is needed is a true coverage measurement tool that does not require source code preprocessing, can be used on any type of program, and does not require modification of existing programs or test suites.